<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //创建一个父类,也可以叫做基类
        class Parent{
            //设置实例属性的方式有两种
            constructor(name,age){
                this.name = name
                this.age = age
            }
            hobby = "吃喝玩乐"
            //设置原型方法
            eat(){
                console.log("吃遍大江南北");
            }

            //设置父类的静态方法
            static say(){
                console.log("谆谆教导");
            }
        }


        class Child extends Parent{
            //创建子类自己的this
            constructor(name,age,sex){
                super(name,age)
                this.sex = sex
            }

            want = "坚持努力就很棒"

            play(){
                console.log("贪玩");
            }

            static rest(){
                console.log("永远睡不够");
            }
        }

        const Child1 = new Child("张三","18","女")
        console.log(Child1);

    </script>
</body>
</html>